from typing import Any

from recruit.adapter.database.models import User, Base, Resume
from tests.adapter.models.utils import check_fields, check_valid_data


def test_user_model(get_user: dict[str, Any]) -> None:
    assert issubclass(User, Base)
    user_model = User(**get_user)
    check_valid_data(user_model, get_user)
    user_model.resume = [Resume()]
    assert isinstance(user_model.resume, list)
    assert len(user_model.resume) > 0


def test_fields() -> None:
    fields = ('id', 'user_id', 'username')
    check_fields(fields, User)
